<template>
  <div class="app-container">
    <wise-crud ref="wise-crud" :urls="urls" :fields="fields" :handle="handle" :filters="filters" />
  </div>
</template>
<script>
import WiseCrud from '@/components/Crud/wiseCrud'
export default {
  name: 'FacilityManage',
  components: {
    WiseCrud
  },
  data() {
    return {
      urls: {
        list: '/api/v1/welder-sbtx-second/hj-equipment-info-comb/list',
        add: '/api/v1/welder-sbtx-second/hj-equipment-info/create',
        show: '/api/v1/welder-sbtx-second/hj-equipment-info-comb/show/',
        update: '/api/v1/welder-sbtx-second/hj-equipment-info-comb/update/',
        delete: '/api/v1/welder-sbtx-second/hj-equipment-info-comb/remove/'
      }
    }
  },    mounted() {
       
    },

  computed: {
    spaceId() {
      return this.$store.getters.entSpaceId
    },
    handle() {
      // if (this.$store.state.user.project) {
      //   return ['add']
      // } else {
      //   return ['add', 'filters']
      // }
      return ['add']
    },
    fields() {
      let arr = [{
        label: '序号',
        type: 'index',
        use: ['table']
      }]
      arr.push( {
        label: '设备类型',
        prop: 'typeName',
        type: 'select',
        url: '/api/v1/welder-sbtx-second/dictionary',
        labelKey: 'name',
        valueKey: 'code',
        labelWidth: '130px',
        objKeys: [{
          field: 'typeCode',
          key: 'code'
        }],
        filters: [{
          field: 'st',
          operator: 'NE',
          value: 9
        },
        {
          field: 'pdCode',
          operator: 'EQUALS',
          value: 'deviceType'
        }
        ],
        rules: [{
          required: true,
          message: '请输入设备型号',
          trigger: 'change'
        }],
        use: ['add', 'edit']
      },{
        label: '设备名称',
        prop: 'name',
        type: 'text',
        labelWidth: '130px',
        use: ['table', 'add', 'view', 'edit', 'search']
      }, {
        label: '品牌',
        prop: 'brand',
        type: 'text',
        labelWidth: '130px',
        rules: [{
          required: true,
          message: '请输入设备名称',
          trigger: 'change'
        }],
        use: ['table', 'add', 'view', 'edit', 'search']
      }, {
        label: '设备编号',
        prop: 'serialNum',
        type: 'text',
        labelWidth: '130px',
        rules: [{
          required: true,
          message: '请输入设备编号',
          trigger: 'change'
        }],
        use: ['table', 'add', 'view', 'edit', 'search']
      }, {
        label: '设备型号',
        prop: 'modelNumber',
        type: 'text',
        labelWidth: '130px',
        rules: [{
          required: true,
          message: '请输入设备型号',
          trigger: 'change'
        }],
        use: ['table', 'add', 'view', 'edit', 'search']
      },  {
        label: '设备类型',
        prop: 'typeName',
        labelWidth: '130px',
        use: ['table', 'view']
      },
       
      {
        label: '设备参数',
        prop: 'electricity',
        type: 'number',
        labelWidth: '130px',
        use: ['table', 'add', 'view', 'edit', 'search']
      }, {
        prop: 'entSpaceId',
        defaultValue: this.$store.getters.entSpaceId,
        use: ['add', 'edit']
      })
      arr.push({
        label: '操作',
        type: 'handle',
        use: ['table'],
        handle: ['view', 'edit', 'delete'],
        tableWidth: 300
      })
      return arr
    },
    filters() {
      return [{
        field: 'entSpaceId',
        operator: 'EQUALS',
        value: this.$store.getters.entSpaceId
      }]
    }
  },
  methods: {}
}
</script>

<style>
</style>
